var app=angular.module("registerapp",[])
 app.controller("registerController",function($scope,$http){
	
	 
	 $scope.onclickRegister=function(){
	
	
		
	$http({
		 method:'POST',
		 url:'/life/registerP',
		 params:{userName:$scope.username,pwd:$scope.pwd,selectId:$scope.selectId,email:$scope.email}
	 }).then(function successCallback(response) {
		
			if("Y"==response.data.result){
	          	alert("chenggong");
         	window.location.href="/life/wsq/success.html";
         	$http({
       		 method:'POST',
       		 url:'/life/sendemail',
       		 params:{userName:$scope.username,email:$scope.email}
       	 }).then(function successCallback(response) {
       		 
       		 
       	 }, function errorCallback(response) {
                // 请求失败执行代码
          });
         	}else if(response.data.result=="S"){
         		$("#myModal").modal('show');
				$("#model").text("邮箱已注册");		         		
         	}else if(response.data.result=="N"){
         		$("#myModal").modal('show');
				$("#model").text("用户名已存在");
         		
         
         		
         	}else{
         			
         		}
	         // 请求成功执行代码
	     }, function errorCallback(response) {
	         // 请求失败执行代码
	   });
	
	
	 
	
	
	
	
	 }
 });